<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<s:layout-definition>
<html>
<head>
  <title><c:out value="${nadpis}"/></title>
  <link rel="stylesheet" type="text/css" href="${pageContext.servletContext.contextPath}/css/style.css"/>
  <meta equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
    <div id="wrapper">
        <div id="header" class="container">
            <div id="logo">
                <h1><s:link href="/index.jsp">Pokemon League Participation Manager</s:link></h1>
                <p>FI MU - PA165 - podzim 2012</p>
            </div>
            <div id="banner">
                <sec:authorize access="isAnonymous()">
                    <img src="${pageContext.servletContext.contextPath}/css/images/header_logo.jpg" width="667" height="118" alt=""/>
                </sec:authorize>
                <sec:authorize access="hasRole('ROLE_ADMIN')">
                    <img src="${pageContext.servletContext.contextPath}/css/images/header_logo_administrator.jpg" width="667" height="118" alt=""/>
                </sec:authorize>
                <sec:authorize access="hasRole('ROLE_USER')">
                    <img src="${pageContext.servletContext.contextPath}/css/images/header_logo_trainer.jpg" width="667" height="118" alt=""/>
                </sec:authorize>
            </div>
	</div>
        <div id="menu" class="container">
            <ul>
                <!--This code sets <li class="active"> to highlight a current page in menu bar using css style.
                    Identifier that code uses is page context atribute named 'nadpis'.-->
                <%! public String checkStrings(String string1, String string2, String output) {
                    if(string1.equals(string2)) {
                        return output;
                    } else {
                        return new String();
                    }
                } %>
                <f:message key="layout.item.intro" var="intro"/>
                <f:message key="layout.item.trainer" var="trainer"/>
                <f:message key="layout.item.pokemon" var="pokemon"/>
                <f:message key="layout.item.stadium" var="stadium"/>
                <f:message key="layout.item.badge" var="badge"/>
                <li class=<%= checkStrings((String)pageContext.getAttribute("nadpis"), (String)pageContext.getAttribute("intro"), "active") %>><s:link href="/index.jsp">${intro}</s:link></li>
                <%--<sec:authorize access="hasRole('ROLE_ADMIN')">--%>
                <li class=<%= checkStrings((String)pageContext.getAttribute("nadpis"), (String)pageContext.getAttribute("trainer"), "active") %>><s:link beanclass="com.pokemon.web.TrainerActionBean" event="all">${trainer}</s:link></li>
		<li class=<%= checkStrings((String)pageContext.getAttribute("nadpis"), (String)pageContext.getAttribute("pokemon"), "active") %>><s:link href="/pokemons/all">${pokemon}</s:link></li>
		<li class=<%= checkStrings((String)pageContext.getAttribute("nadpis"), (String)pageContext.getAttribute("stadium"), "active") %>><s:link href="/stadiums/all">${stadium}</s:link></li>
                <%--</sec:authorize>--%>
                <%--<sec:authorize access="hasAnyRole('ROLE_USER', 'ROLE_ADMIN')">--%>
                <li class=<%= checkStrings((String)pageContext.getAttribute("nadpis"), (String)pageContext.getAttribute("badge"), "active") %>><s:link href="/badges/all">${badge}</s:link></li>
                <%--</sec:authorize>--%>
            </ul>
	</div>
        <div id="top-bar" class="container">
            <div class="bar">
                <sec:authorize access="isAnonymous()">
                    <%@include file="login.jsp"%>
                </sec:authorize>
                <sec:authorize access="isAuthenticated()">
                    <%@include file="logout.jsp"%>
                </sec:authorize>
            </div>
	</div>
        <div id="page" class="container">
            <s:layout-component name="telo"/>
            <div class="clearfix">&nbsp;</div>
            <div id="footer-bar" class="two-cols">
                <div class="col1">
                    <p><em>&bdquo;I want to be the very best, like no one ever was. To catch them is my real test, to train them is my cause. I&nbsp;will travel across the land, searching far and wide. Each Pokemon to understand the power that's inside. It's you and me. I know it's my destiny. You're my best friend in a world we must defend.<br/>
                    <b>Pokemon! Gotta catch 'em all!</b>&ldquo;<br/></em></p>
                </div>
                <div class="col2">
                    <div class="validate">
                        <a href="http://validator.w3.org/check/referer">
                            <img src="http://www.w3.org/Icons/valid-xhtml11" alt="Valid XHTML 1.1" title="Valid XHTML 1.1" height="31" width="88"/>
                        </a>
                        <a href="http://jigsaw.w3.org/css-validator/check/referer">
                            <img src="http://www.w3.org/Icons/valid-css" alt="Valid CSS" title="Valid CSS" height="31" width="88"/>
                        </a>
                    </div>
                </div>
                <div class="clearfix">&nbsp;</div>
            </div>
        </div>
    </div>
    <div id="footer" class="container">
        <p>(c) 2010. <f:message key="layout.created"/> <a href="http://www.nodethirtythree.com/">nodethirtythree</a>. <f:message key="layout.modified"/> <a href="http://fi.muni.cz/~xpaulis">xpaulis</a>.</p>
    </div>
</body>
</html>
</s:layout-definition>